package com;

import java.util.Arrays;

public class Test2 {
    public static void main(String[] args) {
        int[] arr = {11, 54, 6, 5, 78, 98, 78, 100};
        System.out.println(arrayTOString(arr));
    Arrays.sort(arr);
        System.out.println(arrayTOString(arr));
        for (int i = 0; i <arr.length-1; i++) {
            for (int j = 0; j <arr.length-1-i ; j++) {
                if(arr[j]>arr[j+1]){
                    int temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }
//        System.out.println(arrayTOString(arr));
//        String s = Arrays.toString(arr);
//        System.out.println(s);

    }
    public  static String arrayTOString(int[] arr) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                sb.append("]");
            } else {
                sb.append(arr[i]).append(" ");
            }
        }
        return sb.toString();
    }

}
